from dataclasses import dataclass
import operator


@dataclass
class Student:
    name: str
    age: int


s_1 = Student("tony", 18)
s_2 = Student("jack", 17)

students = [s_1, s_2]
students.sort(key=operator.attrgetter("age"))
print(students)
